import * as types from '../types'

export default {
  namespaced: true,
  state: {
    info: {},
    token: ''
  },
  getters: {
    info: state => state.info,
    token: state => state.token
  },
  actions: {
    info ({commit, state}, data) {
      commit(types.USER_INFO, data)
    },
    token ({commit, state}, data) {
      commit(types.USER_TOKEN, data)
    }
  },
  mutations: {
    [types.USER_INFO] (state, payload) {
      state.info = payload
    },
    [types.USER_TOKEN] (state, payload) {
      state.token = payload
    }
  }
}
